package com.richest.api.service.impl;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.richest.api.dao.EmployeeRoleMapper;
import com.richest.api.service.IEmployeeRoleService;
import com.richest.bean.EmployeeRoleBean;

/**
 * 员工和角色关联信息管理服务接口实现
 * 
 * @author 杨博
 * @version richest-api 2.0
 *
 */
@Service
public class EmployeeRoleServiceImpl implements IEmployeeRoleService {

	@Autowired
	private EmployeeRoleMapper mapper;

	@Override
	public Long employeeRoleAdd(EmployeeRoleBean bean) {
		return mapper.employeeRoleAdd(bean);
	}

	@Override
	public Integer employeeRoleDelete(Long id) {
		return mapper.employeeRoleDelete(id);
	}

	@Override
	public EmployeeRoleBean employeeRoleSelectOneById(Long id) {
		return mapper.employeeRoleSelectOneById(id);
	}

	@Override
	public List<EmployeeRoleBean> employeeRoleSelectListByEmployeeId(Long employeeId, Integer pageNumber,
			Integer pageSize) {
		Map<String, Object> params = new HashMap<>();
		params.put("column", "employee_id");
		params.put("value", employeeId);
		params.put("beginNumber", (pageNumber - 1) * pageSize);
		params.put("endNumber", pageNumber * pageSize - 1);
		return mapper.employeeRoleSelectListByMap(params);
	}
}
